{extend name="common@base" /}
{block name="content"}
<section class="content" id="container">
  <div class="box box-default">
    <div class="box-header with-border">
      <div class="box-title">查询</div>
      <div class="box-tools"><button id="btn-develop" class="btn btn-default btn-xs" type="button">开发调试</button></div>
    </div>
    <div class="box-body">
      <form action="" method="get" name="search" class="form">
        <div class="form-group">
          <label for="">一卡通或真实姓名
            <input type="text" name="search[username]" value="{$search[username]}" class="form-control">
          </label>
          <label for="">数据ID
            <input type="text" name="search[data_id]" value="{$search[data_id]}" class="form-control">
          </label>
          <label for="">模块
            <input type="text" name="search[module]" value="{$search[module]}" class="form-control">
          </label>
          <label for="">控制器
            <input type="text" name="search[controller]" value="{$search[controller]}" class="form-control">
          </label>
          <label for="">操作
            <input type="text" name="search[action]" value="{$search[action]}" class="form-control">
          </label>
          <label for="">IP
            <input type="text" name="search[ip]" value="{$search[ip]}" class="form-control">
          </label>
          <button class="btn btn-default">查询</button>
          <a class="btn btn-default" href="{:url('index')}">重置</a>
        </div>
      </form>
    </div>
  </div>
  <div class="box box-primary" style="word-break:break-all; word-wrap:break-all;">
    <div class="box-header with-border">
      <div class="box-title pull-right"></div>
    </div>
    <div class="box-body table-responsive">
      <table id="myTable" class="table table-striped">
        <thead>
        <tr>
          <th width="50">序号</th>
          <th width="100">用户</th>
          <th width="100">数据ID</th>
          <th width="30%">数据</th>
          <th class="js-develop hide">模块</th>
          <th class="js-develop hide">控制器</th>
          <th class="js-develop hide">操作</th>
          <th>IP</th>
          <th>时间</th>
        </tr>
        </thead>
        <tbody>
        {foreach $rows as $row}
        <tr>
          <td>{$row.id}</td>
          <td>{$row.realname}</td>
          <td>{$row.data_id}</td>
          <td>
            {php}
            $arr=json_decode($row[extra],true);
            if(!$arr):
              echo $row[extra];
            else:
              foreach($arr as $k=>$v):
                echo $k . '：' . $v . '<br/>';
              endforeach;
            endif;
            {/php}
          </td>
          <td class="js-develop hide">{$row.module}</td>
          <td class="js-develop hide">{$row.controller}</td>
          <td class="js-develop hide">{$row.action}</td>
          <td>{$row.ip}</td>
          <td>{$row.create_time}</td>
        </tr>
        {/foreach}
        </tbody>
      </table>
    </div>
    <div class="box-footer">
      {$rows->render()}
    </div>
  </div>

</section>
{/block}
{block name="page_script"}
<script>
  $("#btn-develop").on("click",function(){
    $(".js-develop").toggleClass("hide");
  });
</script>
{/block}
</body>
</html>
